package com.hspedu.jdbc.datasource;

import com.hspedu.jdbc.utils.JDBCUtils;

import java.sql.Connection;
import java.sql.SQLException;

/**
 * @author 谷其昊
 * @version 1.0
 * @date 2022/4/10
 * @time 17:35
 */
public class ConQuestion {
    public static void main(String[] args) throws SQLException {
        long start = System.currentTimeMillis();
        for (int i = 0; i < 2000; i++) {
            Connection connection = JDBCUtils.getConnection();
            if (connection != null){
                connection.close();
            }
        }
        long end = System.currentTimeMillis();
        System.out.println("建立两千次连接时间为："+(end-start));
    }
}
